var path = require('path')
var Webpack = require('webpack')

module.exports = {
    mode:"production",
    // 入口文件
    entry: __dirname + '/src/main.js',
    output: {
        // 打包后输出的目录
        path: __dirname + '/dist',
        // 打包后资源文件的前缀
        // publicPath: '/dist/',
        filename: 'build.js'
    },
    resolve: {
        modules: [path.resolve(__dirname, './dist'),'node_modules'],
        extensions: ['*','.js', '.vue'],
    },
    // 处理不同后缀的文件
    module: {
        rules: [{
            test: /\.js$/,
            use: ['babel-loader'],
            exclude: /node_modules/
        }]
    },
    // webpack-dev-server配置
    devServer: {
        historyApiFallback: true,
        noInfo: true
    },
    // 开启source-map，webpack有多种source-map，在官网文档可以查到
    devtool: '#eval-source-map'
}